// --------------------------------------------------------------------------------------------------------------------
// <copyright file="JsonException.cs" company="Leonardo Boshell">
//   Copyright (c) 2007 Leonardo Boshell. All rights reserved.
// </copyright>
// <author name="Leonardo Boshell" email="leonardoboshell@users.sourceforge.net"/>
// <license>
//   All the source code and related files distributed with this software have
//   been dedicated to the public domain by the authors.
//   
//   Anyone is free to copy, modify, publish, use, compile, sell, or distribute
//   the software, either in source code form or as a compiled binary, for any
//   purpose, commercial or non-commercial, and by any means.
//   
//   Thank you for reading this notice. Inspired by the enlightened words used by
//   the authors of another software project, a very popular one, also in the
//   public domain, here's a blessing:
//   
//     May you find forgiveness for yourself and forgive others.
//     May you experience and share the gift of uncoditional love.
//     May you see light, wherever the illusion of darkness appears.
// </license>
// --------------------------------------------------------------------------------------------------------------------

namespace GameKits.LitJson
{
    using System;

    /// <summary>
    /// Base class throwed by LitJSON when a parsing error occurs.
    /// </summary>
    public class JsonException : ApplicationException
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="JsonException"/> class.
        /// </summary>
        public JsonException()
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="JsonException"/> class.
        /// </summary>
        /// <param name="message">
        /// The message.
        /// </param>
        public JsonException(string message)
            : base(message)
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="JsonException"/> class.
        /// </summary>
        /// <param name="message">
        /// The message.
        /// </param>
        /// <param name="inner_exception">
        /// The inner_exception.
        /// </param>
        public JsonException(string message, Exception inner_exception) :
            base(message, inner_exception)
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="JsonException"/> class.
        /// </summary>
        /// <param name="token">
        /// The token.
        /// </param>
        internal JsonException(ParserToken token) :
            base(String.Format(
                   "Invalid token '{0}' in input string", token))
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="JsonException"/> class.
        /// </summary>
        /// <param name="token">
        /// The token.
        /// </param>
        /// <param name="inner_exception">
        /// The inner_exception.
        /// </param>
        internal JsonException(ParserToken token, Exception inner_exception) :
            base(String.Format("Invalid token '{0}' in input string", token), inner_exception)
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="JsonException"/> class.
        /// </summary>
        /// <param name="c">
        /// The c.
        /// </param>
        internal JsonException(int c) :
            base(String.Format("Invalid character '{0}' in input string", (char)c))
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="JsonException"/> class.
        /// </summary>
        /// <param name="c">
        /// The c.
        /// </param>
        /// <param name="inner_exception">
        /// The inner_exception.
        /// </param>
        internal JsonException(int c, Exception inner_exception) :
            base(String.Format("Invalid character '{0}' in input string", (char)c), inner_exception)
        {
        }
    }
}
